﻿using AvaVSExt.Attributes;
using System;
using System.Linq;
using System.Reflection;

namespace AvaVSExt
{
    public partial class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            var para = args.FirstOrDefault();
            if (string.IsNullOrWhiteSpace(para)) return;

            var type = typeof(Program);
            foreach (var item in type.GetMethods())
            {
                var vsCommand = item.GetCustomAttribute<VSCommandAttribute>();
                if (vsCommand is null) continue;
                if (string.Equals(para, vsCommand.CommandName, StringComparison.OrdinalIgnoreCase))
                {
                    item.Invoke(null, null);
                    return;
                }
            }
        }

    }
}
